package cn.wolfcode.shop.cloud.mq;

import cn.wolfcode.shop.cloud.web.controller.SeckillOrderInfoController;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(
        consumerGroup = MQConstans.CREATE_ORDER_BRDER_GROUP,
        topic = MQConstans.CREATE_ORDER,
        selectorExpression = MQConstans.CREATE_ORDER_BRDER_TAG,
        messageModel = MessageModel.BROADCASTING
)
@Slf4j
public class OrderBroadMQListener implements RocketMQListener<Long> {

    @Override
    public void onMessage(Long goodId) {
        log.debug("进入到广播队列");
        SeckillOrderInfoController.flag.put(goodId, false);
    }
}
